package merlin.dao;

import java.util.*;
import java.sql.*;

public class RegistrationDetailsDAO implements java.io.Serializable{

	Connection con;

	public RegistrationDetailsDAO(Connection connection){
		con = connection;
	}

	public int addRegistrationDetails(int reportTitlesId,String firstName,String surname,String companyName,String postcode,String emailAddress)throws SQLException{
		String sql = "INSERT INTO NSD.REGISTRATION_DETAILS(" +
						"REPORT_TITLES_ID,FIRST_NAME,SURNAME,COMPANY_NAME,POSTCODE,EMAIL_ADDRESS)VALUES(" +
						"?,?,?,?,?,?)";

		PreparedStatement pstmt = con.prepareStatement(sql);
		pstmt.setInt(1,reportTitlesId);
		pstmt.setString(2,firstName);
		pstmt.setString(3,surname);
		pstmt.setString(4,companyName);
		pstmt.setString(5,postcode);
		pstmt.setString(6,emailAddress);
		int updateCols = pstmt.executeUpdate();
		pstmt.close();
		return updateCols;
	}
}